<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>    
    var user="黄金岁月";
        function first(){
            console.log(user);//黄金岁月
        }
        function second(){
            var user="王小波";
            first();
        }
        second();
        //因为first函数在全局定义的，执行时找的是window上的user，尽管first函数是在second函数中执行的
    </script>
</body>
</html>